/**
 * Copyright (C) 2017-2018 pinganfang, Inc. All Rights Reserved.
 */

package com.pingan.haofang.searchcloud.api;

import java.util.LinkedHashMap;

/**
 * @author huhailiang937
 * @date 2017年5月5日上午10:56:08
 * @since 1.0.0
 */
public class IndexRowData extends LinkedHashMap<String, Object> {

    private static final long serialVersionUID = 4040420174717552587L;

    private String pkFieldName;

    private String versionFiled;

    private Long version;

    /**
     * 数据删除状态的列名
     */
    private OperateEnum operate;

    public IndexRowData() {

    }

    public IndexRowData(String pkName) {
        super();
        this.pkFieldName = pkName;
        operate = OperateEnum.INSERT;
    }

    public IndexRowData(String uniqueKey, OperateEnum operateType) {
        this(uniqueKey);
        operate = operateType;
    }

    public IndexRowData build(String filedName, Object filedValue) {
        this.put(filedName, filedValue);
        return this;
    }

    /**
     * 获取操作类型
     * 
     * @see OperateEnum
     * @return
     */
    public OperateEnum getOperate() {
        return operate;
    }

    public String getPkFieldName() {
        return pkFieldName;
    }

    public Object getPkFieldValue() {
        return this.get(pkFieldName);
    }

    public String getVersionFiled() {
        return versionFiled;
    }

    public void setVersionFiled(String versionFiled) {
        this.versionFiled = versionFiled;
    }

    public Long getVersion() {
        return version;
    }

    public void setVersion(Long version) {
        this.version = version;
    }
}
